package com.jic.interaction.ChinaPost.controller;

import com.jic.common.base.vo.RestResult;
import com.jic.interaction.ChinaPost.model.vo.request.MemberInfoRequest;
import com.jic.interaction.ChinaPost.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

@RestController
@Api(value="会员信息", tags = "会员信息", description = "UserConsumeDetailController")
@RequestMapping("/memberInfo/")
public class MemberCoontroller {

    @Resource
    private MemberService memberService;

    @PostMapping("saveMember")
    @ApiOperation(value="添加会员")
    private RestResult<Boolean> save(@Valid @RequestBody MemberInfoRequest request) throws InterruptedException, ExecutionException, IOException {
        return RestResult.success(memberService.save(request)>0);
    }

    @ApiOperation("修改会员")
    @PostMapping("updateMember")
    private RestResult<Boolean> update(@Valid @RequestBody MemberInfoRequest request) throws InterruptedException, ExecutionException, IOException {
        return RestResult.success(memberService.update(request)>0);
    }



}
